<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <#include "../head.ftl">
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">课程管理</a>
            <a>
              <cite>培训计划创建</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form" id="planInfoForm">
                        <div class="layui-form-item">
                            <label for="nickName" class="layui-form-label">
                                <span class="x-red">*</span>计划名称
                            </label>
                            <div class="layui-input-inline">
                                <input type="text" id="planName" name="planName"
                                       value="" required=""
                                       lay-verify="fileName"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">
                                <span class="x-red">*</span>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">起始时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="startTime" name="startTime"
                                       placeholder="yyyy-MM-dd">
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">结束时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="endTime" name="endTime"
                                       placeholder="yyyy-MM-dd">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label"><span class="x-red">*</span>课程</label>
                            <div class="layui-input-block">
                                <#list courses as c>
                                    <input type="checkbox" name="courses" value="${c.courseName?if_exists}" lay-skin="primary" title="${c.courseName?if_exists}">
                                </#list>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">计划描述</label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输入内容" name="planDesc" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="L_repass" class="layui-form-label">
                            </label>
                            <button class="layui-btn" lay-filter="add" lay-submit="">
                                保存
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'layer', 'laydate'],
            function () {
                $ = layui.jquery;
                var form = layui.form,
                        layer = layui.layer, laydate = layui.laydate;

                laydate.render({
                    elem: '#startTime'
                });

                laydate.render({
                    elem: '#endTime'
                });

                form.on('submit(add)', function (data) {
                    var param = $("#planInfoForm").serializeArray();
                    $.post("${basePath}/plan/save", param, function (rs) {
                        //string 转 json
                        var obj = eval('(' + rs + ')');
                        if (obj.status == 200) {
                            layer.alert("保存成功", {icon: 6});
                        } else {
                            layer.alert(obj.message);
                        }
                    })
                    return false;
                });

            });
</script>
<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>
</html>
